home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 1
/
Precision Software Applications Silver Collection Volume One (PSM) (1993).iso
/
tutor
/
cptuts22.arj
/
NEWDATE.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-20
|
523b
|
21 lines
// Chapter 7 - Program 10
#include "newdate.h"
extern int days[];
// This routine ignores leap year for simplicity, and adds
// the days in each month for all months less than the
// current month, then adds the days in the current month
// up to today.
int new_date::get_day_of_year(void)
{
int index = 0;
day_of_year = 0;
while (index < month)
day_of_year += days[index++];
return (day_of_year += day);
}